pp108 : reload Method

reload Method


This method searches the whole document for new elements to be validated, and registers the new elements that has thefieldTypeproperty set.

Syntax

validateID.reload()

Return Value


No return value.

Remarks


This method is particularly useful in conjunction when elements are needed to be added dynamically, and there are more number of dynamically created elements for which the add method cannot be used. Once called, it validates and re-checks the whole document and registers all the elements in the document again.

However, usage of both these methods can be avoided if either the style attribute or the class attribute is set for each item that is added dynamically as below:

var dynamicElmt = document.createElement("<input fieldType="text" required class='validate'>");

Example


The following example shows how reload method is used.

//Create a new element of type text dynamically
var textElmt = document.createElement("<input fieldType='text'>");
//Create an element of type amount with a regular expression which expects for 4 decimal points
var amountElmt = document.createElement("<input fieldType='amount' regExpr='^[-+]?\d+(\.\d{4})+$'>");
//Create an integer with a maxValue of 10 and a minValue of 2 and set required
var integerElmt = document.createElement("<input fieldType='integer' maxValue=10 minValue=2 required>");
//Call reload method. "validater" is the ID of the component
validater.reload();

See Also


validate, add